<template>
  <div>
    <el-container>
      <el-header>
        <div class="tou">
          <h3 style="color: #fff">青悟商城</h3>
        </div>
        <div class="tou1">管理员</div>
      </el-header>
      <el-container>
          <el-aside width="200px">
        <h3 style="color: white">青梧商城</h3>
        <el-menu
          default-active="2"
          :unique-opened="true"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="black"
          text-color="#fff"
          active-text-color="#ffd04b"
          router
        >
          <el-submenu
            :index="String(item.id)"
            v-for="item in leftList"
            :key="item.id"
          >
            <template slot="title">
              <i :class="item.icon"></i>
              <span>{{ item.name }}</span>
            </template>
            <el-submenu
              :index="String(ele.id)"
              v-for="ele in item.children"
              :key="ele.id"
            >
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>{{ ele.name }}</span>
              </template>
              <el-menu-item
                :index="String(eles.link)"
                v-for="eles in ele.children"
                :key="eles.id"
                >{{ eles.name }}</el-menu-item
              >
            </el-submenu>
          </el-submenu>
        </el-menu>
      </el-aside> 
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      shu: [],
      frist: {},
      nei: [],
    };
  },
  created() {
    this.http.get("http://pc.qingwuit.com/api/Admin/menus").then((res) => {
      console.log(res.data.data);
      // this.shu = res.data.data[0].children.silce(0,1)
      this.nei = res.data.data[0].children.slice(0, 1);
      this.shu = res.data.data.slice(0, 1);
      this.san = res.data.data[0].children.slice(1, 5);
      // console.log(this.nei);
      console.log(this.san);
    });
  },
  methods: {
    handleOpen(key, keyPath) {
      // console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      // console.log(key, keyPath);
    },
  },
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
.tou {
  width: 199px;
  height: 100%;
  background-color: #545c64;
}
.tou1 {
  text-align: center;
  width: 108px;
  height: 100%;
  background-color: #e9eef3;
}
.el-header {
  display: flex;
  justify-content: space-between;
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #000;
  color: #fff;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>